import { ComponentMetadata, Snippet } from '@alilc/lowcode-types';

const TrackViewMeta: ComponentMetadata = {
  componentName: 'TrackView',
  title: '轨迹查看',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  group: '员工管理',
  category: '数据展示',
  priority: 0,
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'TrackView',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '基础配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'title',
            title: '组件标题',
            setter: 'StringSetter',
            defaultValue: '轨迹查看',
          },
          {
            name: 'englishTitle',
            title: '英文标题',
            setter: 'StringSetter',
            defaultValue: 'Track View',
          },
          {
            name: 'searchPlaceholder',
            title: '搜索占位符',
            setter: 'StringSetter',
            defaultValue: '请输入员工名字',
          },
        ],
      },
      {
        title: '轨迹记录数据',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'trackRecords',
            title: '轨迹记录',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'key',
                          title: '唯一标识',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'employee',
                          title: '员工',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'position',
                          title: '位置',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'track',
                          title: '轨迹操作',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              {
                key: '1',
                employee: '员工1',
                position: '东区',
                track: '查看',
              },
              {
                key: '2',
                employee: '员工2',
                position: '东区',
                track: '查看',
              },
              {
                key: '3',
                employee: '员工3',
                position: '东区',
                track: '查看',
              },
              {
                key: '4',
                employee: '员工4',
                position: '东区',
                track: '查看',
              },
            ],
          },
        ],
      },
      {
        title: '事件处理',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'onSearch',
            title: '搜索事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'onTrackClick',
            title: '轨迹点击事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'onClick',
            title: '点击事件',
            setter: 'FunctionSetter',
          },
        ],
      },
      {
        title: '外观',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'style',
            title: '自定义样式',
            setter: 'StyleSetter',
          },
          {
            name: 'className',
            title: '自定义类名',
            setter: 'StringSetter',
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: ['onClick', 'onSearch', 'onTrackClick'],
    },
    component: {},
  },
};

const snippets: Snippet[] = [
  {
    title: '轨迹查看',
    screenshot: '',
    schema: {
      componentName: 'TrackView',
      props: {
        title: '轨迹查看',
        englishTitle: 'Track View',
        searchPlaceholder: '请输入员工名字',
        trackRecords: [
          {
            key: '1',
            employee: '员工1',
            position: '东区',
            track: '查看',
          },
          {
            key: '2',
            employee: '员工2',
            position: '东区',
            track: '查看',
          },
          {
            key: '3',
            employee: '员工3',
            position: '东区',
            track: '查看',
          },
          {
            key: '4',
            employee: '员工4',
            position: '东区',
            track: '查看',
          },
        ],
      },
    },
  },
];

export default {
  ...TrackViewMeta,
  snippets,
};